const nodemailer = require('nodemailer');
const {mailer: {username, password}} = require('../config');


let transporter = nodemailer.createTransport({
    service: 'qq',
    port: 465,
    secure: true, // true for 465, false for other ports
    auth: {
        user: username, // generated ethereal user
        pass: password // generated ethereal password
    }
});

module.exports = function (mailOptions) {
    transporter.sendMail(mailOptions, (error, info) => {
        if (error) {
            return console.log(error);
        }
        console.log('Message sent: %s', info.messageId);
        console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
    });
};

